package com.yxj04;

import java.io.*;

public class BufferedStreamDemo01 {
    public static void main(String[] args) throws IOException {
        //BufferedWriter(Writer out)
//        FileWriter fw = new FileWriter("D:\\Ccode\\jdata-structure\\ByteStream9\\bw.txt");
//        BufferedWriter bw = new BufferedWriter(fw);
//        BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\Ccode\\jdata-structure\\ByteStream9\\bw.txt"));
//        bw.write("hello\t\n");
//        bw.write("world\t\n");
//
//        bw.close();

        //BufferedReader(Reader in)
        BufferedReader br = new BufferedReader(new FileReader("D:\\Ccode\\jdata-structure\\ByteStream9\\bw.txt"));
//        int ch;
//        while((ch = br.read()) != -1) {
//            System.out.print((char)ch);
//        }

        char[] chs = new char[1024];
        int len;
        while((len = br.read(chs)) != -1) {
            System.out.print(new String(chs,0,len));
        }

        br.close();
    }
}
